#!/usr/bin/env python

import wsgiref.handlers
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
import datetime
from django.utils import simplejson

from model import Question

class MyHandler(webapp.RequestHandler):
    
    def get(self):
        
        # add questions
        questions=db.Query(Question)
        questionsName = [];
        
        for quest in questions:
            questionsName.append(quest.text)
        
        # add subjects/topics
        
        self.response.out.write(simplejson.dumps(questionsName))

def main():
    app = webapp.WSGIApplication([
        (r'.*', MyHandler)], debug=True)
    wsgiref.handlers.CGIHandler().run(app)

if __name__ == "__main__":
    main()